<%@page import="tr.com.argela.tap.mot.models.User"%>
<%@page import="tr.com.argela.tap.mot.models.Project"%>
<%@page import="tr.com.argela.tap.mot.models.Module"%>
<%@page import="tr.com.argela.tap.mot.dao.ProjectDao"%>
<%@page import="tr.com.argela.tap.mot.dao.ModuleDao"%>
<%@page import="tr.com.argela.tap.mot.dao.AuthenticationDao"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
   
   
   <html>
   
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link rel="stylesheet" type="text/css" href="style/styles.css">
    </head>
  
    <%
     User user = (User)request.getSession().getAttribute("userObject");
     String name = user.getName();
     
%>
    <body>
    <h4 align="right">Welcome <%=name%></h4>
    <h5 align="right"><a href="logout.jsp">Log out</a></h5>
       <div align="center"> <h1 align="center">MOT</h1><h5 align="center">Memory Of Testing</h5></div>
        
        <dıv align="left">
        <table align="left">
             <tr><td>
	        <h4><a href="currentProjects.jsp">Current Projects</a></h4>
	    </td></tr>
	      <tr><td>
	      	<h4><a href="createProject.jsp">Create Project</a></h4>
	    </td></tr>
	       <tr><td>
	         <h4><a href="projectVersion.jsp">Create Project Version</a></h4>
	    </td></tr>
	      <tr><td>
	         <h4><a href="versions.jsp">Project Versions</a></h4>
	    </td></tr>
	        <tr><td>
	          <h4><a href="users.jsp">Users</a></h4>
	    </td></tr>
	        <tr><td>
	           <h4><a href="export.jsp">Export Document</a></h4>
	    </td></tr>
        </table>
        </dıv> 
        <form action="ModuleServlet" >
  
        <dıv align="right">
         <table border="3" align="center">
    <tr><th colspan="2" align="center"> Create New Module </th></tr>
    <tr><td>Select Project : </td><td><select name="pname">
    <% 
		ProjectDao proDao = new ProjectDao();
		
		List<Project> projects = proDao.seeProjects();
		
		for (Project project : projects) {
		%> 
		<option value="<%=project.getId()%>" ><%=project.getName()%></option>
		
		<% }
		
	%>
    
	</select></td></tr>
	<tr><td>Module Name:</td><td><input type="text" name="modulename"></td></tr>			
    <tr><td>Module Description:</td><td><input type="text" name="mdescription"></td></tr>
    <tr><td>Select Dependent People:</td>
    <td><select name="username">
	 <% 
		AuthenticationDao autDao = new AuthenticationDao();
		
		List<User> users = autDao.seeUsers();
		
		for (User userli : users) {
		%> 
		<option value="<%=userli.getId()%>" ><%=userli.getName()%></option>
		
		<% }
		
	%>
    
	</select></td></tr>
    <tr><td colspan="2" align="center"> 
    
    <input  type="hidden" name="module" id="module" value="createmodule"/>
    <input type="submit" name="newproject" value="Save">
    <input type="reset" name="cancel" value="Cancel">
    </td></tr>
    </table></dıv>
    
    </form>
    </body>
    </html>